<template>
	<view class="page tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
		<view class="top-bg"></view>
		<dawnBar title="挂号须知"></dawnBar>
		<view class="page-container">
			<!-- 医院信息 -->
			<view class="hosp-info" style="margin-top: 0;">
				<view class="list-item" style="padding: 10px;">
					<!-- <view class="list-head tn-flex tn-flex-direction-row tn-flex-col-center tn-flex-row-between">
						<view class="justify-content-item ">
							<tn-tag backgroundColor="tn-main-gradient-dawn" fontColor="#FFFFFF" shape="circleRight"
								width="auto" fontSize="dawn-text-lg">
								{{ appConfig.appTitle || ''}}
							</tn-tag>
						</view>
					</view> -->
					<view class="list-content tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-between">
						<view class="tn-flex tn-flex-direction-column">
							<view class="tn-flex tn-flex-nowrap  tn-flex-col-center tn-flex-row-left">
								<view @click="navDteail(item)" v-if="appConfig.logoUrl">
									<!-- <image mode="aspectFill" class="hosp-image" :src="appConfig.logoUrl"/> -->
									<tn-avatar :src="appConfig.logoUrl" size="120rpx"></tn-avatar>
								</view>
								<view class="tn-padding-left-xs">
									<view>
										<!-- <tn-tag backgroundColor="tn-main-gradient-dawn" fontColor="#FFFFFF" shape="circleRight"
											width="auto" fontSize="dawn-text-lg">
											{{ appConfig.appTitle || ''}}
										</tn-tag> -->
										<text
											class="dawn-text-md tn-text-bold tn-color-dawn">{{ appConfig.appTitle || ''}}</text>
									</view>
									<view class="tn-margin-top-ss">
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__1">{{appConfig.companyRespVO.level || '' }}</tn-tag>
										<text class="tn-color-gray tn-padding-left-xs tn-padding-right-xs">|</text>
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__2">{{appConfig.companyRespVO.nature || '' }}</tn-tag>
										<text class="tn-color-gray tn-padding-left-xs tn-padding-right-xs">|</text>
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__3">{{appConfig.companyRespVO.business || '' }}</tn-tag>
									</view>
									<view class="tn-margin-top-xs">
										<view @click="callPhoneNumber(appConfig.companyRespVO.phone)">
											<!-- <text class="tn-color-black">电话：</text> -->
											<text 
												class="tn-icon-tel-circle-fill tn-margin-right-xs tn-color-dawn"></text>
											<text
												class="tn-text-md">{{ appConfig.companyRespVO.phone  || '' }}</text>
											
										</view>
									</view>
								</view>
							</view>
			
							<view class="tn-margin-top-xs" @click="navNoAuth('/hosp/company/map')">
								<view>
									<text class="tn-icon-map-fill tn-margin-right-xs tn-color-dawn"></text>
									<text>{{appConfig.companyRespVO.address || '' }}</text>
								</view>
							</view>
			
						</view>
						<!-- <view @click="navDteail(appConfig)"
							class="tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-right">
							<view class="tn-text-right">
								<text class="tn-icon-right tn-color-gray"></text>
							</view>
						</view> -->
					</view>
				</view>
			</view>
			
			<view class="tn-bg-white dawn-shadow dawn-radius" v-if="articleInfo.title">
				<view class='newsDetail'>
					<view class='title'>{{ articleInfo.title }}</view>
					<!-- <view class='item tn-flex tn-flex-row-left tn-flex-col-center'>
						<view v-if="articleInfo.author" class='tn-margin-right-xs'>{{ articleInfo.author }}</view>
						<view class='tn-margin-right-xs'><text
								class='tn-icon-time-fill tn-padding-right-xs'></text>{{ formatDate(articleInfo.createTime) }}
						</view>
						<view class='tn-margin-right-xs'><text
								class='tn-icon-footprint tn-padding-right-xs'></text>{{ articleInfo.views }}
						</view>
					</view> -->
					<view class='conters'>
						<jyf-parser :html="articleInfo.content" ref="article" :tag-style="tagStyle" />
					</view>
				</view>
			</view>
		</view>

		<!-- loading -->
		<dawnLoading :show="loading"></dawnLoading>

		<view v-if="show">
			<dawnMsg :msg="msg"></dawnMsg>
		</view>

		<!-- 悬浮按钮-->
		<view class="tn-flex tn-footerfixed0">
			<view class="tn-flex-4 tn-padding justify-content-item tn-text-center">
				<view style="height: 100%;" class="tn-flex tn-flex-col-center tn-flex-row-center" 
					@click="goHome()">
					<text>不同意</text>
				</view>
			</view>
			<view class="tn-flex-8 tn-padding-xs justify-content-item tn-text-center tn-bg-dawn-dark">
				<view style="height: 100%;" class="tn-flex tn-flex-col-center tn-flex-row-center" 
					@click="nav('/hosp/register/dept')">
					<text class="tn-text-bold">我已阅读并同意</text>
				</view>
			</view>
		</view>

		<!-- 悬浮按钮-->
		<NavBtn></NavBtn>
	</view>
</template>

<script>
	import page_mixin from '@/mixins/page_mixin.js'
	import dayjs from '@/plugin/dayjs/dayjs.min.js';
	import parser from "@/hosp/components/jyf-parser/jyf-parser";
	import * as PatientApi from '@/api/hospital/patient.js';
	import * as ArticleApi from '@/api/cms/article.js';
	import * as api from '@/api/api.js';
	import * as config from "@/api/config.js";
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	const app = getApp();

	export default {
		name: 'order',
		mixins: [page_mixin],
		components: {
			"jyf-parser": parser
		},
		computed: mapGetters(['appConfig', 'uid', 'isLogin', 'userInfo', 'patientInfo']),
		data() {
			return {
				loading: false,
				show: false,
				msg: '',
				articleInfo: {},
				tagStyle: {
					img: 'width:100%;'
				},
			}
		},
		onLoad(options) {
			console.info("query onLoad")
			if (!this.isLogin) {
				toLogin();
				return;
			} else {
				let that = this;
				this.getData();
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		methods: {
			toCreate(item) {
				let params = JSON.parse(options.params);
				uni.navigateTo({
					url: '/hosp/order/info?params=' + JSON.stringify(item)
				})
			},
			getData() {
				let that = this;
				this.loading = true;
				ArticleApi.getArticlePage({
					categoryKey: config.CMS_TYPE.REG_NOTICE
				}).then(res => {
					that.loading = false;
					if (res.code === 0) {
						const l = res.data.list || [];
						if (l.length > 0) {
							that.$set(this, 'articleInfo', l[0]);
						}
					}
				});
			},
			formatDate: function(date) {
				return dayjs(date).format("YYYY-MM-DD");
			},
			formatDateTime: function(date) {
				return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
			}
		}
	}
</script>


<style lang="scss" scoped>
	.newsDetail {
		padding: 30rpx 0;
	}

	.newsDetail .title {
		padding: 0 30rpx;
		font-size: 34rpx;
		color: #282828;
		font-weight: bold;
		line-height: 1.5;
	}

	.newsDetail .item {
		padding: 20rpx 30rpx;
		// font-size: 34rpx;
		color: #8A8B8C;
		// font-weight: bold;
		line-height: 1.5;
	}

	.newsDetail .conters {
		padding: 30rpx;
		font-size: 30rpx;
		color: #282828;
		line-height: 1.7;
	}

	.newsDetail .bnt {
		color: #fff;
		font-size: 30rpx;
		width: 690rpx;
		height: 90rpx;
		border-radius: 45rpx;
		margin: 48rpx auto;
		text-align: center;
		line-height: 90rpx;
	}
</style>